﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Derbster.Domain
{
    public class ScoringPass
    {
        [ContractVerification(false)]
        internal ScoringPass()
        {
            
        }

        public ScoringPass(Scoring scoring, int pass, int score)
        {
            Contract.Requires(scoring != null);
            Contract.Requires(pass >= 1);
            Contract.Requires(score >= 0 && score <= 6);

            Scoring = scoring;
            Pass = pass;
            Score = score;
        }

        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ScoringPassId { get; internal set; }
        public Scoring Scoring { get; internal set; }
        public int Pass { get; internal set; }
        public int Score { get; internal set; }

        public bool VerifyPass()
        {
            if (Pass == 0) return false;
            if (Score < 0 || Score > 6) return false;

            return true;
        }
    }
}
